import request from '@/utils/request';
import { rsaEncrypt } from '@/utils/commonUtil3';

// 门店管理
// 获取门店列表
export function getShopList(data) {
	return request({
		url: '/user/store/select',
		method: 'get',
		params: data
	});
}

// 分配门店
export function assignShop(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/user/store/allocation',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 获取用户列表
export function getUserList(data) {
	return request({
		url: '/user/store/getUser',
		method: 'get',
		params: data
	});
}

// 获取临期预警列表
export function getWarningList(data) {
	return request({
		url: '/warn/select',
		method: 'get',
		params: data
	});
}

// 获取门店下拉列表
export function getShopListSelect(data) {
	return request({
		url: '/user/store/selectSimple',
		method: 'get',
		params: data
	});
}

// 获取现金收款列表
export function getCashList(data) {
	return request({
		url: '/cash/select',
		method: 'get',
		params: data
	});
}

// 获取商品兑换列表
export function getExchangeList(data) {
	return request({
		url: '/exchange/getList',
		method: 'get',
		params: data
	});
}

// 获取商品信息列表
export function getGoodsList(data) {
	return request({
		url: '/commodity/select',
		method: 'get',
		params: data
	});
}

// 分页获取门店盘点信息
export function getInventoryList(data) {
	return request({
		url: '/pda/selectStocktakingByMarket',
		method: 'get',
		params: data
	});
}

// 获取门店盘点详情
export function getInventoryDetail(data) {
	return request({
		url: '/pda/getTasksSummaryByMarket',
		method: 'get',
		params: data
	});
}

// 门店盘点详情导出
export function exportInventoryDetail(data) {
	return request({
		url: '/pda/export',
		responseType: 'blob',
		method: 'POST',
		data: data
	});
}

// 商品兑换记录导出
export function exportExchangeDetail(data) {
	return request({
		url: '/exchange/export',
		responseType: 'blob',
		method: 'POST',
		data: data
	});
}

// 门店今日营业额
export function getShopTurnover(data) {
	return request({
		url: '/turnover/today/' + data.storeId,
		method: 'get'
		// params: data
	});
}

// 门店昨日营业额
export function getShopTurnoverYesterday(data) {
	return request({
		url: '/turnover/yesterday/' + data.storeId,
		method: 'get'
		// params: data
	});
}

// 获取历史营业额概况
export function getShopTurnoverHistory(data) {
	return request({
		url: '/turnover/history',
		method: 'get',
		params: data
	});
}
